/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package conf;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.util.Properties;
import javax.servlet.http.HttpServlet;

/**
 *
 * @author xDrake
 */
public class AppConfig {
    private String sql_server = "";
    private String sql_port = "";
    private String sql_database = "";
    private String sql_user = "";
    private String sql_pass = "";

    public AppConfig() {
        try {
            BufferedInputStream inputStream = new BufferedInputStream(AppConfig.class.getResourceAsStream("../../config.xml"));
            Properties prop = new Properties();
            prop.loadFromXML(inputStream);
            inputStream.close();

            sql_server = prop.getProperty("sql_server");  
            sql_port = prop.getProperty("sql_port");
            sql_database = prop.getProperty("sql_database");          
            sql_user = prop.getProperty("sql_user");
            sql_pass = prop.getProperty("sql_pass");
            
            //sql_server = this.getServletContext().getRealPath("");
        } catch (IOException ex) {
            System.out.println("############################################");
            System.out.println(ex.getMessage());
            System.out.println("############################################");
        }        
    }

    public String getSql_database() {
        return sql_database;
    }

    public String getSql_pass() {
        return sql_pass;
    }

    public String getSql_port() {
        return sql_port;
    }

    public String getSql_server() {
        return sql_server;
    }

    public String getSql_user() {
        return sql_user;
    }
    
}
